package com.dragon.speech.common.web;

import org.springframework.util.StringUtils;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by jinlong.hao on 16/5/19.
 */
public class CommandInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request,
                             HttpServletResponse response, Object handler) throws Exception {
        String serverName = request.getServerName();
        if (!StringUtils.isEmpty(serverName) && serverName.equals("localhost")) {
            return true;
        } else {
            return false;
        }
    }

}
